package com.component;

import org.springframework.cloud.client.ServiceInstance;
import org.springframework.stereotype.Component;

import java.lang.annotation.Annotation;
import java.util.List;
import java.util.Random;
@Component
public class RandomLoadBalance implements LoadBalance {

    public ServiceInstance getSingleAddres(List<ServiceInstance> serviceInstances) {
        int index=new Random().nextInt(serviceInstances.size());
        return serviceInstances.get(index);
    }
}
